<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="tag" uri="/form/tld/systag.tld"%>
<%@ page import="operate.*"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String id = request.getParameter("id");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>My JSP 'index.jsp' starting page</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link rel="StyleSheet" href="<%=basePath %>form/css/table.css" type="text/css" />
		<link rel="StyleSheet" href="<%=basePath %>form/css/validate.css" type="text/css" />
		<script type="text/javascript" src="<%=basePath %>form/js/jquery-1.4.2.min.js"></script>
		<script type="text/javascript" src="<%=basePath %>form/js/easy_validator.pack.js"></script>
		<script type="text/javascript">
		function select(){
		var code=$("#valueList").val();
		if(code==''){
		$("#selectType").html('<input type="text" name="defaultValue">');
		return;
		}
		 $.ajax({
					  url: "<%=basePath%>servlet/DictServlet?method=dictByCode",
					  type: "post",
					  data:{"code":code},
					  cache: false,
					  async:false,
					  error:function(){
					    alert("请求出错");
					  },
					  success: function(html){
					    $("#selectType").html(html);
					  }
					});
		}
		</script>
	</head>
	<body>
	<% 
	 Map<String,String> map=AttrOper.findAttrById(id);%>
	
	<fieldset> 
	<legend> 
				<font color="red">添加表单属性</font>
	</legend>
	<form action="<%=basePath  %>servlet/FormServlet?method=addFormAttr" method="post">
	<input type="hidden" name="cid" value="<%=id %>">
		<table align="center" width="400px" class="TableBlock">
			    <tr><td class="TableContent">名称</td><td><input type="text" name="aname" tip="不能为空" reg="^.+$" value="<%=map.get("ANAME") %>"></td>
				<tr><td class="TableContent">类型</td><td><select name="type"><option value="text">文本框</option><option value="password">密码框</option><option value="select">下拉框</option><option value="checkbox">多选框</option><option value="radio">单选框</option><option value="textarea">内容框</option></select></td>	</tr>
				<tr><td class="TableContent">备选项</td><td><tag:dictTypeShow selectName="valueList" fun="onchange='select()'" defaultValue='<%=map.get("VALUE_LIST") %>'/></td></tr>
				<tr><td class="TableContent">默认值</td><td><span id="selectType"><input type="text" name="defaultValue"></span></td></tr>
				<tr><td class="TableContent">列表显示</td><td><tag:dictShow code="yesOrNO" selectName="listView"  defaultValue='<%=map.get("DEFAULT_VALUE") %>'/></td></tr>
			    <tr><td class="TableContent">编辑显示</td><td><tag:dictShow code="yesOrNO" selectName="updateView" defaultValue='<%=map.get("UPDATE_VIEW") %>'/></td></tr>
				<tr><td class="TableContent">提示</td><td><input type="text" name="tip" value="<%=map.get("TIP") %>"></td></tr>
				<tr><td class="TableContent">正则表达式名称</td><td><input type="text" name="regName" value="<%=map.get("REG_NAME") %>"></td></tr>
				<tr><td class="TableContent">正则表达式</td><td><input type="text" name="reg" value="<%=map.get("REG") %>"></td></tr>
		     	<tr><td colspan="2" align="center"><input type="submit"  value="添加"><input type="reset" value="清空"><input type="reset" value="返回"></td></tr>
		</table>
	 </form>
	 </fieldset>
	</body>
</html>
